GBML manual / Rooms

region_name

The name of the region of the world the player is in, as you named it in the Regions list ("Forest", "The Old Road"); in a long room cut into regions, the region the object the camera follows stands in. In a room that has no regions it is still the last region the player was in. An empty text before the player has been in any.

Syntax

region_name() -> string

Returns

string

Description

The name of the region the player is in, as you named it in the world's Regions list ("Forest", "The Old Road"). In a room that is not part of a world (a house, a cave you drew as an ordinary room) it is still the last region the player was in, so a heads-up display keeps saying "Crypt" inside the crypt's houses. Before the player has been in any region it is an empty text.

The name changes in the frame after the player arrives in a part of the world that belongs to another region. If your game never asks for region names, they are not kept in the game at all.

In a long room cut into regions it is the name of the region the object the camera follows stands in.

Example

draw_text(8, 8, region_name());

Shows the name of the region in the corner of the screen.

On the GBA

The region changes when the player walks into a part of the world that belongs to another region, and region_name() answers the new name from the frame that happens on. A name longer than your project's string size is cut short, never a crash. Region names are kept in the game only when some code asks for them.

See also: region_enteredregion_currentworld_currentWhat a region does in the game